const path = require('path')
const htmlwebpackplugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader');

module.exports = {
    entry: path.join(__dirname, './src/main.js'),
    output: {
        path: path.join(__dirname, './dist'),
        filename: 'bundle.js'
    },
    module: {
        rules: [
            { test: /\.css$/, use: ['style-loader', 'css-loader'] },
            { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
            { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
            { test: /\.(jpg|png|gif|svg|ttf|jpeg)$/, use: 'url-loader?name=[name].[ext]' },
            { test: /\.vue$/, use: 'vue-loader' },
            { test: /\.(eot|woff)(\?\S*)?$/, use: 'file-loader' }

        ]

    },
    // 将页面放入内存中，这样就不用导入包了
    plugins: [
        new htmlwebpackplugin({
            template: path.join(__dirname, './src/index.html'),
            filename: 'index.html'
        }),
        new VueLoaderPlugin()
    ]
} 